Display current date and timeΒΆ

datetime.datetime.now()
** datetime.date.today()**

Write a python script to display the
a) Current date and time
b) Current year
c) Month of year
d) Week number of the year
e) Weekday of the week
f) Day of year
g) Day of the month
h) Day of week
import time
import datetime

print("Current date and time: " , datetime.datetime.now())
print("Current year: ", datetime.date.today().strftime("%Y"))
print("Month of year: ", datetime.date.today().strftime("%B"))
print("Week number of the year: ", datetime.date.today().strftime("%W"))
print("Weekday of the week: ", datetime.date.today().strftime("%w"))
print("Day of year: ", datetime.date.today().strftime("%j"))
print("Day of the month : ", datetime.date.today().strftime("%d"))
print("Day of week: ", datetime.date.today().strftime("%A"))

Output:

Current date and time: 2018-10-15 06:36:32.867369
Current year: 2018
Month of year: October
Week number of the year: 42
Weekday of the week: 1
Day of year: 288
Day of the month : 15
Day of week: Monday